<%@ page import="com.oceansoft.core.domain.SysResource" %>
<%@ page import="com.oceansoft.core.common.util.StringUtil" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/common/common.jsp" %>
<%
    List<SysResource> rlist = (List<SysResource>) session.getAttribute("rlist");
%>
<html>
<head>
    <meta charset="utf-8"/>
    <title>厅干部平时考核管理系统</title>
    <link rel="stylesheet" type="text/css" href="<c:url value='/resource/jxkh/css/iconfont.css'/>"/>
    <script type="text/javascript">
        function getContentSize() {
            var h = document.documentElement.clientHeight; //clientHeight内容可视区域的高度
            ch = h + "px";
            njgabottom = (h + 85) + "px";
            njga_lf_ul_wh = (h - 238) + "px";
            //document.getElementById("njga_rt_main").style.height = ch;
            document.getElementById("njga_bottom").style.height = njgabottom;
            //document.getElementById("njga_bottom").style.minHeight = njgabottom;
        }
        window.onload = getContentSize; //页面加载时调用getContentSize()
        window.onresize = getContentSize; //当改变窗口大小时会出发getContentSize()
        //菜单切换
        $(function () {
            pageSwitch('<c:url value='/jump/index1.html'/>', 1);
            //菜单切换
            $("#ul_nav > li").click(function () {
                $(this).addClass("li_hov1");
                $(this).siblings("li").removeClass("li_hov1");
                $(this).children(".ul_two_w").addClass("ul_two_w_hov1");
                $(this).siblings("li").children(".ul_two_w").removeClass("ul_two_w_hov1");
                $(".ul_two a").removeClass("a_hov");
            });
            $(".ul_two a").click(function (e) {
                e = e || window.event;
                if (e.stopPropagation) {
                    e.stopPropagation();
                } else {
                    e.cancelBubble = true;
                }
                $(this).addClass("a_hov").siblings("a").removeClass("a_hov");
                $(this).parents("li").siblings("li").children("a").removeClass("a_hov");
            });
            // $("#njga_lf_ul_w").panel({iWheelStep:32});
            $("#timeDiv").hide();
            if ("${issign}" == "0") {
                sign(1);
                var open = layer.open({
                    type: 1, //0（信息框，默认）1（页面层）2（iframe层）3（加载层）4（tips层）。
                    shift: 1, //动画    0-6     css3动画
                    closeBtn: 1, //关闭按钮  0 不显示  style  1和2  标题为 false 2
                    title: ['', 'background:#fff;color:#fff;'],
                    area: ['240px', '280px'], //宽高
                    content: $("#qdcg_pop") //iframe层-禁滚动条  $("#photosDemo").html()   'http://www.baidu.com/'
                });
            }else{

                if ("${issign}" == "1") {
                    $("#timeDiv").show();
                    $("#signTime").html("签到时间：" + "${signin.signintime}");

                } else if ("${issign}" == "2") {
                    $("#timeDiv").show();
                    $("#signTime").html("签退时间：" + "${signin.signouttime}");
                }
            }
        });
        function pageSwitch(url, mark) {
            if (mark == 1) {
                $("#indexlevel").remove();
//                $("njgn_nav").css("margin-bottom","10px");  $("#indexlevel").remove();
                $(".njgn_nav_wraper").css("height", "45px");
                // $("ul_nav").remove();
            } else {
                $(".njgn_nav_wraper").css("height", "90px");
            }
            getContentSize();
            if (url == '') {
                //document.getElementById("ifrm_data").src = "#";
            } else {
                window.location.href = "#ul_nav";
                document.getElementById("ifrm_data").src = url;
            }
        }
        function exitSys() {
            window.location.href = "<c:url value='/profile/exit.html'/>";
        }
        function sign(type) {
            $.ajax({
                url: "<c:url value='/sign/signin.json'/>",
                type: "post",
                data: {
                    type: type
                },
                success: function (data) {
                    $("#timeDiv").show();

                    if (type == 1) {
                        $("#sign1").css("display", "none");
                        $("#sign2").css("display", "block");
                        $("#sign3").css("display", "none");
                        $("#signTime").html("签到时间：" + data.time);
                    } else if (type == 2) {
                        $("#sign1").css("display", "none");
                        $("#sign2").css("display", "none");
                        $("#sign3").css("display", "block");
                        $("#signTime").html("签退时间：" + data.time);
                    }
                }
            });
        }
    </script>
</head>

<body style="background: #ededed;">
<div class="qdcg_pop" id="qdcg_pop">
    <img src="<c:url value='/resource/jxkh/images/success.png'/>" />
    <p>&nbsp;签到成功！</p>
</div>
<div class="njga_rt_main index-new">
    <!--header-->
    <div class="njga_top">
        <div class="index_content">
            <div class="logo">
                <img src="<c:url value='/resource/jxkh/images/logo_new.jpg'/>"/>
            </div>
            <div class="njga_top_rt">
                <div class="block block2" onclick="exitSys();">
                    <div class="block_icon"></div>
                    <div class="p_text">退出登录</div>
                </div>
                <c:if test="${iscjgb!=1 && iszhz!=1}">
                    <div class="block block1" id="sign1"
                            <c:if test="${issign!=0}">
                                style="display: none;"
                            </c:if>
                         onclick="sign(1)">
                        <div class="block_icon block_icon_hov"></div>
                        <div class="p_text">未签到</div>
                    </div>
                    <div class="block block1" id="sign2"
                            <c:if test="${issign!=1}">
                                style="display: none;"
                            </c:if>
                         onclick="sign(2)">
                        <div class="block_icon"></div>
                        <div class="p_text">未签退</div>
                    </div>
                    <div class="block block1" id="sign3"
                            <c:if test="${issign!=2}">
                                style="display: none;"
                            </c:if>
                    >
                        <div class="block_icon"></div>
                        <div class="p_text">已签退</div>
                    </div>
                    <div id="timeDiv" class="block block3">
                        <p id="signTime"></p>
                        <div class="youjt"></div>
                    </div>
                </c:if>
            </div>
        </div>
    </div>
    <!--header结束-->
    <!--nav-->
    <div class="njgn_nav_wraper">
        <div class="njgn_nav" id="njgn_nav">
            <div class="index_content">
                <ul class="ul_nav" id="ul_nav">
                    <!-- 首页写死在这里，因为要根据角色来判断进入哪个页面，目前已经做好就先不做调整 -->
                    <li class="li_hov1">
                        <a href="javascript:pageSwitch('<c:url value='/jump/index1.html'/>',1)">
                            <span class="a_icon iconfont icon-yingsaitong"></span>
                            <b>首页</b>
                        </a>
                        <div class="ul_two_w" id="indexlevel">
                            <ul class="ul_two"></ul>
                        </div>
                    </li>
                    <%
                        for (int i = 0; i < rlist.size(); i++) {
                            SysResource s = rlist.get(i);
                            int deep = s.getDeep();
                            //System.out.println(deep+"a");
                            String url_ = s.getUrl();
                            String parentId = s.getParent_id();
                            if (StringUtil.isNull(url_)) {
                                url_ = "";
                            } else {
                                url_ = contextPath + url_;
                            }


                            if (1 == deep) {
                    %>
                    <li>
                        <a href="javascript:pageSwitch('<%=url_%>')">
                            <span class="<%=s.getRemark()%>"></span>
                            <b><%=s.getName()%>
                            </b>
                        </a>
                        <div class="ul_two_w">
                            <ul class="ul_two" id="m_2_<%=s.getDbid()%>">

                            </ul>
                        </div>
                    </li>

                    <%
                    } else if (2 == deep) {
                    %>
                    <script type="">

                        var p = $('#m_2_<%=parentId%>');
                        var s = "<li id='m_3_<%=s.getDbid()%>'><a href='javascript:pageSwitch(\"<%=url_%>\")' class='a<%=s.getOrdernum()%>'><span class='<%=s.getRemark()%>'></span><%=s.getName()%></a></li>";
                        p.append(s);
                    </script>

                    <%--
                                        <%
                                        }
                                        else if(3==deep)
                                        {
                                        %>
                                        <script type="">
                                            var p = $('#m_3_<%=parentId%>');
                                            var s = "<ul><li><span><a target='f_<%=s.getDbid()%>' id='<%=s.getDbid()%>' href='<%=url_%>'><%=s.getName()%></a></span></li></ul>";
                                            p.append(s);

                                        </script>--%>


                    <%
                            }
                        }
                    %>
                </ul>
            </div>
        </div>
    </div>
    <!--nav结束-->
    <!--main-->
    <div class="index-new-main" id="njga_bottom"
         style="background: #ededed;width: 1200px;float: left;position: relative;left: 50%;margin:12px 0 0 -600px;overflow-x:hidden;overflow-y:hidden">
        <iframe id="ifrm_data" name="ifrm_data" scrolling="no"
                style="width:1200px;height:100%;margin:0px;padding:0px;border:0px none;overflow-y:hidden;overflow-x:hidden;"
                frameborder="0"></iframe>
    </div>
    <!--footer-->
    <div class="njga_footer">
        <div class="index_content" id="index_content">
            <p class="p1">建议您使用IE9+、FireFox、Google Chrome，分辨率1280*800及以上浏览本网站，获取更好用户体验。</p>
            <p>Copyright@2017 Allright Reserved<span>江苏省公安厅</span>版权所有</p>
            <p>苏ICP备05009012号</p>
        </div>
    </div>
</div>
<!--日历结束-->
</body>

</html>